package drds.binlog.event.mariadb;

import drds.binlog.LogByteBlock;
import drds.binlog.event.FormatDescriptionLogEvent;
import drds.binlog.event.IgnorableLogEvent;
import drds.binlog.event.LogHeader;

/**
 * mariadb的GTID_EVENT类型
 */
public class MariaGtidLogEvent extends IgnorableLogEvent
{

    private long gtid;

    /**
     * <pre>
     * mariadb gtidlog event format
     *     uint<8> GTID sequence
     *     uint<4> Replication Domain ID
     *     uint<1> Flags
     *
     * 	if flag & FL_GROUP_COMMIT_ID
     * 	    uint<8> commit_id
     * 	else
     * 	    uint<6> 0
     * </pre>
     */

    public MariaGtidLogEvent(LogHeader logHeader, LogByteBlock logByteBlock, FormatDescriptionLogEvent formatDescriptionLogEvent)
    {
        super(logHeader, logByteBlock, formatDescriptionLogEvent);
        gtid = logByteBlock.getUlong64().longValue();
        // do nothing , just ignore log event
    }

    public long getGtid()
    {
        return gtid;
    }

}
